package com.cm.caseManagement.service.impl;
import com.cm.caseManagement.utils.DateUtils;

import com.cm.caseManagement.dao.CmSysUserMapper;
import com.cm.caseManagement.pojo.entity.CmSysUser;
import com.cm.caseManagement.service.ICmSysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmSysUserServiceImpl implements ICmSysUserService
{
    @Autowired
    private CmSysUserMapper cmSysUserMapper;

    /**
     * 查询用户
     *
     * @param id 用户主键
     * @return 用户
     */
    @Override
    public CmSysUser selectCmSysUserById(Long id)
    {
        return cmSysUserMapper.selectCmSysUserById(id);
    }

    /**
     * 查询用户列表
     *
     * @param cmSysUser 用户
     * @return 用户
     */
    @Override
    public List<CmSysUser> selectCmSysUserList(CmSysUser cmSysUser)
    {
        return cmSysUserMapper.selectCmSysUserList(cmSysUser);
    }

    /**
     * 新增用户
     *
     * @param cmSysUser 用户
     * @return 结果
     */
    @Override
    public int insertCmSysUser(CmSysUser cmSysUser)
    {
        cmSysUser.setCreateTime(DateUtils.getNowDate());
        return cmSysUserMapper.insertCmSysUser(cmSysUser);
    }

    /**
     * 修改用户
     *
     * @param cmSysUser 用户
     * @return 结果
     */
    @Override
    public int updateCmSysUser(CmSysUser cmSysUser)
    {
        cmSysUser.setUpdateTime(DateUtils.getNowDate());
        return cmSysUserMapper.updateCmSysUser(cmSysUser);
    }

    /**
     * 批量删除用户
     *
     * @param ids 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteCmSysUserByIds(Long[] ids)
    {
        return cmSysUserMapper.deleteCmSysUserByIds(ids);
    }

    /**
     * 删除用户信息
     *
     * @param id 用户主键
     * @return 结果
     */
    @Override
    public int deleteCmSysUserById(Long id)
    {
        return cmSysUserMapper.deleteCmSysUserById(id);
    }
}
